Re: [SQL] Does PostgreSQL have an UPDATE Function like UNIFY? - Mailing list pgsql-sql

From Herouth Maoz
Subject Re: [SQL] Does PostgreSQL have an UPDATE Function like UNIFY?
Date
Msg-id l03130303b376e90c1682@[147.233.159.109]
Whole thread Raw
In response to Does PostgreSQL have an UPDATE Function like UNIFY?  ("John J. Boris, Sr." <john.boris@onlinesvc.com>)
List pgsql-sql
At 03:34 +0300 on 29/05/1999, John J. Boris, Sr. wrote:


> I can delete the records and then add them but I think that
> might be a bit time consuming.

Frankly, I don't think it will be more time consuming. Supposing a COPY
command had to do it itself, it would have to look up each record in the
table, and replace it. So it would probably mark the old one as deleted and
insert the new record. It shouldn't be much faster than:

1) Creating a temp table with the same schema as the main one
2) copying the records into the temp table
3) deleting from the main all the records which exist in the temp  table (DELETE FROM main WHERE main.field =
temp.field);
4) Inserting all records from the temp table using INSERT INTO... SELECT.
5) Dropping the temp table
6) Vacuuming

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma




pgsql-sql by date:

Previous
From: Herouth Maoz
Date:
Subject: Re: [SQL] 2 Table Select
Next
From: "John J. Boris, Sr."
Date:
Subject: Re: [SQL] Does PostgreSQL have an UPDATE Function like UNIFY?